#include "pch.h"
 
#include <iostream>
#include <string>
 
using namespace std;
 
bool checkPassword(string password)
{
    int number = 0;
    if (password.length() < 8)
        return false;
    for (int i = 0;i < password.length();i++)
    {
        if (((password[i] >= 'A') && (password[i] <= 'Z')) || ((password[i] >= 'a') && (password[i] <= 'b')) || ((password[i] >= '0') && (password[i] <= '9')))
        {
            if ((password[i] >= '0') || (password[i] <= '9'))
                number++;
        }
        else
            return false;
    }
    if (number < 2)
        return false;
    else
        return true;
}
 
void PasswordCorrectness(bool password)
{
    if (password == true)
        cout << "valid password" << endl;
    else
        cout << "invalid password" << endl;
}
 
int main()
{
    bool Correctness;
    string password;
    cout << "请输入要检验的密码！" << endl;
    cin >> password;
    Correctness = checkPassword(password);
    PasswordCorrectness(Correctness);
    return 0;
}